{% extends 'base.html' %}
{% block title %}{{ headline }}{% endblock title %}
{% block main %}
  <main>
    <h3>Django Secret Key 生成器</h3>
    {% if django_secret_key %}
      <h6>生成的 Django Secret Key（长度 {{ django_secret_key|length }}）:</h6>
      <div class="django-secret-key text-danger">
        {{ django_secret_key }}
      </div>
    {% endif %}
    <form class="form top-gap" action="{% url "webtools:create_django_secret_key" %}" method="post">
      <div class="text-muted text-small">提示：前后缀均为可选项，设置前后缀能够帮助我们方便地区分不同项目的 Secret Key。</div>
      <div class="flex-left flex-wrap units-gap-big">
        <div class="unit flex-left units-gap unit-1-on-mobile">
          <div class="unit-0">{{ form.prefix.label_tag }}</div>
          <div class="unit">
            {{ form.prefix }}
            <div class="text-muted text-small">{{ form.prefix.errors }}</div>
          </div>
        </div>
        <div class="unit flex-left units-gap unit-1-on-mobile">
          <div class="unit-0">{{ form.suffix.label_tag }}</div>
          <div class="unit">
            {{ form.suffix }}
            <div class="text-muted text-small">{{ form.suffix.errors }}</div>
          </div>
        </div>
      </div>
      {% csrf_token %}
      <button type="submit" class="btn btn-primary">生成</button>
    </form>
    <div>
      <h6>关于 Django Secret Key 生成器</h6>
      <p>Django Secret Key 生成器用于 Django 项目所需的密钥，该密钥将用于 Django 项目中各类加密函数的签名。</p>
      <h6>参考文档</h6>
      <ol>
        <li><a href="https://docs.djangoproject.com/en/dev/ref/settings/#secret-key">https://docs.djangoproject.com/en/dev/ref/settings/#secret-key</a>
        </li>
      </ol>
    </div>
  </main>
{% endblock %}